import Vue from 'vue'
import VueRouter from 'vue-router'

import index from '@/components/Index'
import login from '@/components/Login'
import register from '@/components/Register'
import form from '@/components/Form'
import article from '@/components/Article'

//使用路由
Vue.use(VueRouter)

//配置路由表
//为不同的请求路径配置组件
const routerList = [
    { path: '/', redirect: '/index' },
    { path: '/index', component: index },
    { path: '/login', component: login },
    { path: '/register', component: register },
    { path: '/create', component: form },
    { path: '/update/:aid', component: form, props: true },
    { path: '/article/:aid', component: article, props: true },
];

export default new VueRouter({
    routes: routerList
})